package daos;
 
import entitys.Usuario;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author Amauri
 */
public class UsuarioDAO {
    
    public void Salvar( Usuario usuario ){
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("TrabalhoFinal");
        EntityManager em = emf.createEntityManager();
        
        em.getTransaction().begin();
        em.persist(usuario);
        em.getTransaction().commit();
        
        em.close();
        emf.close();
    }
    
}
